//
//  LogViewController.m
//  UI_APP_Project_Bean
//
//  Created by dllo on 16/6/24.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "LogViewController.h"
#import "LTView.h"

@interface LogViewController ()

@property(nonatomic, retain)LTView *ltView;

@end

@implementation LogViewController

- (void)dealloc
{
    [_ltView release];
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self config];
    [self creatLTViews];
}

-(void)config{
    self.navigationItem.title = @"注册";
    self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"注册" style:UIBarButtonItemStylePlain target:self action:@selector(logIn:)];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"用户登录" style:UIBarButtonItemStylePlain target:self action:@selector(landOn:)];
    
}

-(void)logIn:(UIBarButtonItem *)bar{  // 注册
    LTView *passWord = [self.ltView viewWithTag:101];
    LTView *confirm = [self.ltView viewWithTag:102];
    
    if (passWord.textField.text == confirm.textField.text) {
          UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"恭喜您" message:@"注册成功" preferredStyle:UIAlertControllerStyleAlert];
        [self presentViewController:alert animated:YES completion:^{
            
        }];
    }
    
  
    
    
}

-(void)landOn:(UIBarButtonItem *)bar{  // 登录
    
}

-(void)creatLTViews{
    NSArray *labelArray = @[@"用户名", @"密码", @"确认密码", @"电话", @"邮箱"];
    NSArray *textArray = @[@"请输入用户名", @"请输入密码", @"再次输入密码", @"请输入电话", @"请输入邮箱"];
    for (int i = 0; i < 5; i ++) {
        self.ltView = [[LTView alloc]initWithFrame:CGRectMake(30, 80 + (50 + 30) * i, 300, 60) withLabelText:labelArray [i] withTextField:textArray[i]];
        self.ltView.tag = i + 100;
        [self.view addSubview:_ltView];
        [_ltView release];
    }
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
